package com.utils.basejava.customAnnotation;

/**
 * @author xr-8
 * @date 2021-05-13
 * @time 23:56
 */
public abstract class BizTem<T> {

    public abstract void checkParam();

    public abstract T process() throws Exception;

    public void onError() {
        System.out.println("onerror...");
    }

    public void after() {
        System.out.println("after");
    }

    public T execute() {
        try {
            checkParam();
            T result = process();
            return result;
        } catch (Exception e) {
            onError();
            return null;
        } finally {
            after();
        }
    }
}
